﻿@{
    Layout = null;
}

<!DOCTYPE html>
<html>
<head>
    <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
    <meta http-equiv="Pragma" content="no-cache">
    <meta http-equiv="Cache-Control" content="no-cache">
    <meta http-equiv="Expires" content="0">
    <title>后台管理</title>
    <link href="../../Dist/Login/login.css" rel="stylesheet" type="text/css" />
    <script src="~/Scripts/jquery-3.3.1.min.js"></script>
</head>

<body>
    <div class="login_box">
        <div class="login_l_img"><img src="../../Dist/Login/images/login-img.png" /></div>
        <div class="login">
            <div class="login_logo"><a href="#"><img src="../../Dist/Login/images/login_logo.png" /></a></div>
            <div class="login_name">
                <p>后台管理系统</p>
            </div>
            <form method="post">
                <input name="username" type="text" placeholder="用户名" id="username" onchange="onClear()">
                @* <span id="password_text" onclick="this.style.display='none';document.getElementById('password').style.display='block';document.getElementById('password').focus().select();">密码</span>*@
                <input name="password" type="password" id="password" placeholder="密 码" />
                <input value="登录" style="width:100%;" type="button" onclick="onLogin()">
            </form>
        </div>
        <div class="copyright">某某有限公司 版权所有©2016-2018 技术支持电话：000-00000000</div>
    </div>

    <script>
        function onClear() {
            $("#password").val("");
        }

        function onLogin() {
            if ($("#username").val() == "" || $("#password").val() == "") {
                alert("请输入用户名或密码！");
                return false;
            }
            $.ajax({
                type: "POST",
                url: "/Home/Login",
                data: {
                    username: $("#username").val(), password: $("#password").val()
                },
                dataType: "json",
                success: function (data) {
                    if (data.Success) {
                        window.location.href = "/Home/Index";
                    } else {
                        alert("用户名或密码不正确！");
                    }
                }
            });
        }
    </script>
</body>
</html>

